package cn.zxh.csdn_maven.base.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@SuppressWarnings(value={"unused"})
public class RequestParams {
	
	private String url;
	private Map<String, Object> resulMap=new HashMap<String, Object>();
	public RequestParams(String url){
		List<String> paramsList = new ArrayList<String>();
		this.url=url;
		String[] params = url.split("&");
		for (String param : params) {
			if(param.contains("?")){
				/**第一个参数*/
				paramsList.add(param.substring(param.lastIndexOf("?")+1));
			}else {
				paramsList.add(param);
			}
		}
		for (String param : paramsList) {
			String[] array = param.split("=");
			resulMap.put(array[0],array[1]);
		}
	}
	public String getParamsByName(String name){
		String value="";
		value=resulMap.get(name).toString();
		return value;
	}
}
